home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / mkmk-1.0 / mkmk-1 / mkmk / mkmk.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-28  |  2.4 KB  |  94 lines

  1. #include <stdio.h>
  2. #include <ncurses.h>
  3. #include <getopt.h>
  4. #include "mkmk.h" 
  5.  
  6. int include=0;
  7. char DEFTARGET[255]="none";
  8. char DEFCC[255]="gcc";
  9. char DEFLIBS[255]="none";
  10. char DEFOBJECTS[255]="none";
  11. char DEFCFLAGS[255]="none";
  12. char DEFLIBDIR[255]="none";
  13. char DEFINCDIR[255]="none";
  14.  
  15. main(int argc,char *argv[])
  16. {
  17.   FILE *Makefile,*mgrc;
  18.   char CCFlags[255];
  19.   char ProgName[255];
  20.   char ObjName[255];
  21.   char Libs[255];
  22.   char CC[255];
  23.   char IncDir[255];
  24.   char LibDir[255];
  25.   char INSTALLDIR[255];
  26.   char MODE[255];
  27.  
  28.   char path[255];
  29.   int option=0;
  30.   int private=0;
  31.   char y;
  32.   while ((option = getopt(argc, argv, "hlm:")) != EOF)
  33.     switch(option)
  34.       {
  35.       case 'm':
  36.     private=1;
  37.     sprintf(path,"%s",optarg);
  38.     if((mgrc=fopen(path,"r"))!=NULL)
  39.       read_mgrc(mgrc);   
  40.     break;
  41.       case 'h':
  42.       default:
  43.     printf("usage: %s [-h] [-m rcfile]\n",argv[0]);
  44.     exit(0); 
  45.       }
  46.  
  47.   sprintf(path,"%s/.mkrc",getenv("HOME"));
  48.  
  49.   if(!private)
  50.     if((mgrc=fopen(path,"r"))!=NULL)
  51.       read_mgrc(mgrc);
  52.     else if((mgrc=fopen("/usr/lib/mkrc","r"))!=NULL)
  53.       read_mgrc(mgrc);   
  54.  
  55.   init_curses();
  56.  
  57.   credits();
  58.   boundary_input(ProgName,"TARGET","no default",0,"(Enter the target program name)");
  59.   boundary_input(ObjName,"OBJECTS","no default",0,"(Enter the object files to be used [.o])");
  60.   boundary_input(CCFlags,"CFLAGS",DEFCFLAGS,1,"(Enter any compiler flags to be used)");
  61.   boundary_input(CC,"CC",DEFCC,1,"(Enter the name of the compiler to be used)");
  62.   boundary_input(Libs,"LIBS",DEFLIBS,1,"(Enter any addition libraries needed. Precede them with \"-l\")");
  63.   boundary_input(LibDir,"LIBDIR",DEFLIBDIR,1,"(Enter any additional library search paths. Precede each with \"-L\")");
  64.   boundary_input(IncDir,"INCDIR",DEFINCDIR,1,"(Enter any addition header search paths. Precede each with \"-I\")");
  65.   printw("\nInstall Procedure? [y]"); 
  66.   stdscr->_curx=stdscr->_curx-2;
  67.   y=getch();
  68.   delch();
  69.   insch(y);
  70.   stdscr->_curx=stdscr->_curx+2;
  71.   wrefresh(stdscr);
  72.   switch(y)
  73.     {
  74.     case 'n':
  75.       printf("\n");
  76.       break;
  77.     case 'y':
  78.     case '\n':
  79.       printw("\n");
  80.       include=1;
  81.       boundary_input(INSTALLDIR,"INSTALLDIR","no default",0,"(Enter the full path in which to install the program)");
  82.       boundary_input(MODE,"MODE","no default",0,"(Enter the permissions for the program)");
  83.       break;
  84.     }
  85.   makefile_create(ProgName,ObjName,CCFlags,CC,Libs,LibDir,IncDir,INSTALLDIR,MODE); 
  86.   endwin(); 
  87. }
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.